//
//  NativeVC.m
//  EFExtend
//
//  Created by mac on 15/5/29.
//  Copyright (c) 2015年 Eric. All rights reserved.
//

#import "NativeVC.h"


@interface NativeVC ()

@end

@implementation NativeVC

- (void)dealloc
{
   
    HM_SUPER_DEALLOC();
}

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
	// Do any additional setup after loading the view.
    
    [self.customNavLeftBtn setImage:[UIImage imageNamed:@"back.png"] forState:UIControlStateNormal];
    [self.customNavLeftBtn setFrame:CGRectMakeBound(32, 32)];
    
    [self.customNavRightBtn setImage:[UIImage imageNamed:@"back.png"] forState:UIControlStateNormal];
    [self.customNavRightBtn setFrame:CGRectMakeBound(32, 32)];
    
    self.view.backgroundColor = [UIColor md_amber_500];
    self.navigatorBar.tintColor = [UIColor md_red_200];
    
    [[[[[UIView viewAsButten]
     EFOwner:self.view]
     EFTag:2]
     EFText:@"back"]
     mas_makeConstraints:^(MASConstraintMaker *make) {
         make.top.mas_equalTo(self.view.mas_top).offset(10);
         make.left.mas_equalTo(self.view.mas_left).offset(10);
         make.width.mas_equalTo(60);
         make.height.mas_equalTo(40);
     }];
    
    [[[[[UIView viewAsButten]
        EFOwner:self.view]
       EFTag:3]
      EFText:@"back2"]
     mas_makeConstraints:^(MASConstraintMaker *make) {
         make.top.mas_equalTo(self.view.mas_top).offset(80);
         make.left.mas_equalTo(self.view.mas_left).offset(10);
         make.width.mas_equalTo(60);
         make.height.mas_equalTo(40);
     }];
    [[HMTicker sharedInstance] delay:.5f invoke:^{
      [self showMessageTip:@"TEST" detail:nil timeOut:3.5f];
    }];
}
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation{
    return UIInterfaceOrientationLandscapeRight;
}
- (BOOL) shouldAutorotateToInterfaceOrientation:
(UIInterfaceOrientation)toInterfaceOrientation {
    return (toInterfaceOrientation == UIInterfaceOrientationLandscapeRight);
}
- (UIInterfaceOrientationMask)supportedInterfaceOrientations {
    return UIInterfaceOrientationMaskLandscapeRight;
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

ON_Button(signal){
    UIButten *btn = signal.source;
    if ([signal is:[UIButten TOUCH_UP_INSIDE]]) {
        if ([btn is:@"leftBtn"]) {//customNavLeftBtn
            [self backAndRemoveWithAnimate:YES];
            INFO(self.stack.boards);
        }else if ([btn is:@"rightBtn"]){//customNavRightBtn
            NativeVC *nn = [[NativeVC alloc]init];
            
            [[[HMURLMap boardForMap:@"*"] visableViewController] presentViewController:[[UINavigationController alloc] initWithRootViewController:nn] animated:YES completion:^{
                
            }];
        }else if (btn.tag == 2){
            [self dismissViewControllerAnimated:YES completion:^{
                
            }];
        }else if (btn.tag == 3){
            [HMUINavigationBar setBackgroundColor:[UIColor blueColor]];
        }
    }
}

@end
